
#include "GAGenome.h"

GAGenome::GAGenome(Initializer i, Mutator m)
  {
   _evaluated=false;
   init=i; mutr=m; 
   _alive = true;
  }

GAGenome::GAGenome(const GAGenome &orig)
  {
   GAGenome::copy(orig);
   _alive = true;
  }

	/*
GAGenome* GAGenome::clone() const 
  {
   return new GAGenome(*this);
  }
	*/

void GAGenome::copy(const GAGenome & orig)
 {
  if(&orig == this) return;

  _fitness=orig._fitness; 
  _evaluated=orig._evaluated;
  eval=orig.eval;
  init=orig.init; mutr=orig.mutr;
  sexcross=orig.sexcross;
  randObj = orig.randObj;
 }

float GAGenome::evaluate(bool flag)
 {
  if(_evaluated == false || flag == true)
    {
    if(eval) 
	_fitness = (*eval)(*this); 
    _evaluated = true;
    }
  return _fitness; 
 }

